<template>
  <div class="exchange">
    <navBar :title="title"></navBar>
    <div class="my_annie_bean">
      <div class="my_annie_bean_title">我的安妮豆</div>
      <div class="my_annie_bean_num">
        <span>{{anneBeanNumber}}</span>
        <span class="unit">个</span>
      </div>
    </div>
    <div class="exchange_num">
      <van-cell-group>
        <van-field
          v-model="value"
          placeholder="请输入您想兑换积分的个数"
          input-align="center"
          label-align="right"
        >
          <div class="left_img" slot="left-icon">
            <img width="100%" src="/img/53.png" alt />
          </div>
        </van-field>
      </van-cell-group>
    </div>
    <div class="now_recharge" @click="goExchange">立即兑换</div>
    <div class="effective_time">100个安妮豆可以兑换1积分</div>
    <div class="effective_time">兑换完成后积分相应增加可以参加抵扣</div>
  </div>
</template>

<script>
import navBar from "components/navBar";
import { Field,CellGroup  } from "vant";
Vue.use(Field).use(CellGroup);
export default {
  name: "exchange",
  data() {
    return {
      anneBeanNumber: 0,
      title: "兑换",
      value: ""
    };
  },
  components: {
    navBar
  },
  methods: {
    goExchange() {
      if (this.value && this.value < this.anneBeanNumber) {
        this.$router.push("/integralExchangeRecord");
      } else {
        this.$toast("安妮豆数量不足");
        return;
      }
    }
  }
};
</script>

<style lang="less" rel="stylesheet/less" scoped>
.exchange {
  height: 100vh;
  background-color: #fff;
  .my_annie_bean {
    margin-bottom: 77px;
    height: 111px;
    padding-left: 21px;
    background: rgba(1, 47, 64, 1);
    overflow: hidden;
    .my_annie_bean_title {
      margin-top: 14px;
      font-size: 14px;
      font-family: PingFangSC-Regular;
      font-weight: 400;
      color: rgba(255, 255, 255, 1);
    }
    .my_annie_bean_num {
      margin-top: 11px;
      font-size: 42px;
      font-family: PingFangSC-Medium;
      font-weight: 700;
      line-height: 59px;
      color: rgba(255, 255, 255, 1);
      .unit {
        font-size: 15px;
      }
    }
  }
  .exchange_num {
    font-size: 16px;
    font-family: PingFangSC-Regular;
    font-weight: 400;
    color: rgba(171, 171, 171, 1);
    width: 334px;
    margin: 0 auto;
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
    .left_img {
      position: absolute;
      top: 10px;
      left: 55px;
      width: 23px;
    }
  }
  .now_recharge {
    margin: 0 auto;
    margin-top: 138px;
    width: 333px;
    height: 41px;
    line-height: 41px;
    text-align: center;
    background: linear-gradient(
      90deg,
      rgba(1, 47, 64, 1) 0%,
      rgba(1, 47, 64, 1) 100%
    );
    font-size: 15px;
    font-family: PingFangSC-Regular;
    font-weight: 400;
    color: rgba(255, 255, 255, 1);
  }
  .effective_time {
    padding-top: 8px;
    padding-left: 20px;
    font-size: 14px;
    font-family: PingFangSC-Regular;
    font-weight: 400;
    color: rgba(122, 122, 122, 1);
  }
}
</style>
